Repository navigation
feat(fleet-queue): select enqueue row priority from Drew's label bands (#7030) - #12464
Conversation
…label bands task_from_packet copied the packet's stated priority verbatim, and no label→band mapping existed anywhere in the enqueue path — the 90/70 values of the inverted 2026-10-29 design (expedite ⇒ 90) were produced by machinery outside it, and the broker's priority-ASC claim order reads them as last. Now, when the payload's labels array (the array the claim filter's label field already reads) carries Drew's labels, the band is the selected row priority: expedite ⇒ 15 (the ratified 10–20 band value), next-up ⇒ 25 (the ratified 20–30 band value) — the exact stored values Drew ratified on 2026-11-07, deliberately off PRIORITY_SCALE, which constrains stated values only. Expedite outranks next-up when both are present. Unlabeled packets keep their stated priority (or null) byte-for-byte.
Acceptance oracle, quoted in the test: an expedited issue's task reads in the 10–20 band in the Turso store. Covers expedite (15, superseding a stated 90), next-up (25), both-labels precedence, unrelated/absent labels leaving the stated priority untouched, and the labeled/unstated and unlabeled/unstated cases. Verified fail-before: on the base commit with only the selection reverted, the expedite case reads back 90 instead of 15.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 20 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc3f662a17
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let priority = match label_band_priority(&payload) { | ||
| Some(band) => json!(band), |
There was a problem hiding this comment.
Allow derived priority bands through claim-time validation
Every newly enqueued task carrying expedite or next-up now stores priority 15 or 25, but claim_guard_reason in turso_queue/claim.rs:331 revalidates the stored row with validate_packet, whose PRIORITY_SCALE excludes both values. Consequently, claim_pick_once in turso_queue/lifecycle.rs:436–438 quarantines these tasks instead of handing them to workers, blocking the very issues this change intends to expedite. Distinguish stored-row validation from packet validation so the derived bands pass the claim guard, and cover the enqueue-to-claim path with a regression test.
Useful? React with 👍 / 👎.
First slice of #7030 (build item 2, code half): the label→band mapping now exists in the broker.
What was wrong
The broker claims
ORDER BY (priority IS NULL), priority ASC, created_at ASC(turso_queue/lifecycle.rs, claim_pick_once) — lowest number first. But no label→band mapping existed anywhere in the enqueue path:task_from_packetcopied the packet's stated priority verbatim and never read labels, so the inverted 2026-10-29 values (expedite ⇒ 90, next-up ⇒ 70), applied by external machinery, were stored as-is and Drew's expedited issues were claimed last.Change (validate.rs only, +106/−1)
task_from_packet— the single point where the enqueue row is built — now selects the row priority from the payload'slabelsarray (the same array the claim filter already reads):expedite⇒ 15 (10–20 band),next-up⇒ 25 (20–30 band), the stored values Drew ratified 2026-11-07. Expedite outranks next-up if both are present.validate_packetstill rejects off-scale stated priorities — the derivation happens at row construction, downstream of validation; 15/25 are deliberately offPRIORITY_SCALE, which constrains stated values, not stored rows.Tests
label_bands_select_row_priority_7030(names the fleet-stalling: Drew's expedite set has no active worker #7030 acceptance line): expedite → 15 superseding a stated 90; next-up → 25; both-labels precedence; unrelated/absent labels leave the stated value untouched; unlabeled+unstated stays null; labeled+unstated still selects the band.cargo test -p fleet-queue --all-features: 470 passed, 0 failed; default features 78 passed; rustfmt clean. No pre-existing failures in the crate.Deliberately out of this slice
payload.labelscould not be verified from source. The broker-side contract already reads that key, so the mapping fires whenever labels are present.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.